{include file="public/header" /}
<link href="{$Think.ADMIN_SITE_ROOT}/select2/select2.css" rel="stylesheet"/>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/select2/select2.full.min.js"></script>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/select2/zh-CN.js"></script>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.fuwu_personal_jineng}</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get" name="formSearch" id="formSearch">
        <div class="ds-search-form">
            <dl>
                <dt>{$Think.lang.fuwu_personal_search_phone}</dt>
                <dd><input class="txt" name="search_phone" id="search_phone" value="{$search_phone}" type="text"></dd>
                <dt>分类</dt>
                <dd>
                    <select name="search_gc_id1" id="search_gc_id1">
                        <option value="">{$Think.lang.ds_please_choose}</option>
                        {notemtpy name="$class_list"}
                        {foreach $class_list as $key => $val}
                        <option value="{$val.gc_id}" {$Request.param.search_gc_id1 == $val.gc_id ? 'selected' : ''}>{$val.gc_name}</option>
                        {/foreach}
                        {/notempty}
                    </select>
                    <select name="search_gc_id2" id="search_gc_id2">
                        <option value="">{$Think.lang.ds_please_choose}</option>
                    </select>
                    <select name="search_gc_id3" id="search_gc_id3">
                        <option value="">{$Think.lang.ds_please_choose}</option>
                    </select>
                </dd>
                <dt>品牌</dt>
                <dd>
                    <select name = "search_brandid"  class="show-tick form-control" id="selectbrand">
                        <option value="">请选择</option>
                        {foreach name='brandArr' item='v'}
                        <option value="{$v.brand_id}" {if $search_brandid == $v.brand_id} selected {/if}>{$v.brand_name}</option>
                        {/foreach}
                    </select>
                </dd>
            </dl>
            <div class="btn_group">
                <a href="javascript:document.formSearch.submit();" class="btn " title="{$Think.lang.ds_query}">{$Think.lang.ds_query}</a>
                {if $search_phone != '' || $search_brandid !='' || $search_gc_id1 !=''}
                <a class="btn" href="{:url('Fupersonaljineng/index',['status'=>$status])}" title="{$Think.lang.ds_cancel_search}"><span>{$Think.lang.ds_cancel_search}</span></a>
                {/if}
                <!--<a class="btn btn-default" href="javascript:export_xls('{:url('Brand/export_step1')}')"><span>{$Think.lang.ds_export}Excel</span></a>-->
            </div>
        </div>
    </form>
    <table class="ds-default-table">
        <thead>
        <tr class="thead">
            <th class="w24">手机号</th>
            <th>{$Think.lang.fuwu_personal_cate1}</th>
            <!--<th>{$Think.lang.fuwu_personal_cate2}</th>-->
            <!--<th class="w150">{$Think.lang.fuwu_personal_cate3}</th>-->
            <th class="w150">{$Think.lang.fuwu_personal_brand}</th>
            <th class="w150">{$Think.lang.fuwu_personal_anzhuang}</th>
            <th class="w150">{$Think.lang.fuwu_personal_weixiu}</th>
            <th class="w150">{$Think.lang.fuwu_personal_baoyang}</th>
            <th class="w150">{$Think.lang.fuwu_personal_statuss}</th>
            <th class="w150">{$Think.lang.fuwu_personal_shenhe}</th>
            {if $status != 1}
            <th class="w150">审核人</th>
            <th class="w150">审核时间</th>

            {if $status == 3}
            <th class="w150">{$Think.lang.fuwu_personal_fail}</th>
            {/if}
            {/if}
            <!--<th class="w150">{$Think.lang.fuwu_personal_createdtime}</th>-->
            <th class="w150">{$Think.lang.fuwu_personal_updatedtime}</th>
            {if $status == 1}
            <th class="w120 align-center">{$Think.lang.ds_handle}</th>
            {/if}
        </tr>
        </thead>
        <tbody>
        {notempty name="$data"}
        {foreach name="data" item="v"}
        <tr class="hover edit" id="ds_row_{$v.id}">
            <td class="name">{$v.phone}</td>
            <td class="name" style="width: 900px;">{$v.cateonename}>{$v.catetwoname}>{$v.catethreename}</td>
            <!--<td class="name"></td>-->
            <!--<td class="name"></td>-->
            <td class="name">{$v.brandStr}</td>
            <td class="name">{if $v.anzhuang == 0}{$Think.lang.fuwu_personal_0}{elseif $v.anzhuang ==1} {$Think.lang.fuwu_personal_1}{elseif $v.anzhuang ==2} {$Think.lang.fuwu_personal_2}{/if}</td>
            <td class="name">{if $v.weixiu == 0}{$Think.lang.fuwu_personal_0}{elseif $v.weixiu ==1} {$Think.lang.fuwu_personal_1}{elseif $v.weixiu ==2} {$Think.lang.fuwu_personal_2}{/if}</td>
            <td class="name">{if $v.baoyang == 0}{$Think.lang.fuwu_personal_0}{elseif $v.baoyang ==1} {$Think.lang.fuwu_personal_1}{elseif $v.baoyang ==2} {$Think.lang.fuwu_personal_2}{/if}</td>
            <td>
                {if $v.status2 == '0'}
                <a href="JavaScript:dsLayerConfirm('{:url('Fupersonaljineng/edit_status',['column'=>'status2','value'=>1,'id'=>$v.id])}','{$Think.lang.ds_ensure_edit_status}',{$v.id});"><img src="{$Think.ADMIN_SITE_ROOT}/images/dispatch_jump_error.png"  width="22px"></a>
                {else /}
                <a href="JavaScript:dsLayerConfirm('{:url('Fupersonaljineng/edit_status',['column'=>'status2','value'=>0,'id'=>$v.id])}','{$Think.lang.ds_ensure_edit_status}',{$v.id});"><img src="{$Think.ADMIN_SITE_ROOT}/images/dispatch_jump_success.png"></a>
                {/if}</td>
            <td class="name">
                {if $v.status == '1'}
                {$Think.lang.fuwu_personal_statuss1}
                {elseif $v.status=='2'}{$Think.lang.fuwu_personal_statuss2}
                {elseif $v.status=='3'}{$Think.lang.fuwu_personal_statuss3}
                {/if}
            </td>
            <!--<td class="name">{$v.created_at}</td>-->
            {if $status != 1}
            <th class="w150">{$v.status_admin_name}</th>
            <th class="w150">{$v.status_at}</th>
            {if $status == 3}
            <td class="name">{$v.fail}</td>
            {/if}
            {/if}

            <td class="name">{$v.updated_at}</td>
            <td class="align-center">
                {if $v.status == 1}
                <a style="width:65px;" class="dsui-btn-edit" href="javascript:dsLayerOpen('{:url('Fupersonaljineng/view',['id'=>$v.id])}','审核-{$v.phone}','600px','300px')"><i class="iconfont"></i>审核</a>
                {else/}
                {/if}
            </td>
        </tr>
        {/foreach}
        {else /}
        <tr class="no_data">
            <td colspan="10">{$Think.lang.ds_no_record}</td>
        </tr>
        {/notempty}
        </tbody>
        <tfoot>
        {notempty name="data"}
        <tr colspan="15" class="tfoot">
            <!--<td><input type="checkbox" class="checkall" id="checkallBottom"></td>-->
            <!--<td colspan="16">-->
                <!--<label for="checkallBottom">{$Think.lang.ds_select_all}</label>-->
                <!--&nbsp;&nbsp;<a href="JavaScript:void(0);" class="btn btn-small" onclick="submit_delete_batch()"><span>{$Think.lang.ds_del}</span></a>-->
            <!--</td>-->
        </tr>
        {/notempty}
        </tfoot>
    </table>
    {$showpage}
    <div class="clear"></div>
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/mlselection.js"></script>
<link rel="stylesheet" href="{$Think.CHAT_SITE_URL}/css/chat.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/jquery-ui-timepicker-addon.min.js"></script>
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery-ui-timepicker/i18n/jquery-ui-timepicker-zh-CN.js"></script>
<script type="text/javascript" src="{$Think.PLUGINS_SITE_ROOT}/jquery.mousewheel.js"></script>
<script type="text/javascript">
    $(function () {
        $("#selectbrand").select2();
    })
    function submit_delete(ids_str){
        _uri = ADMINSITEURL+"/Fupersonal/del.html?id=" + ids_str;
        dsLayerConfirm(_uri,'{$Think.lang.ds_ensure_del}');
    }
</script>
<script type="text/javascript">

    function getGcId1(gc_id1, select_id)
    {
        var select_od = select_id;
        $.ajax({
            type : "GET",
            contentType: "application/json;charset=UTF-8",
            url : ADMINSITEURL+"/Question/getClass.html?gc_id=" + gc_id1,
            success : function(result) {
                result = JSON.parse( result );
                var html = '<option value="">选择分类</option>';
                for(var i=0;i<result.length;i++){
                    if (result[i].gc_id == select_id) {
                        html += '<option selected value="'+ result[i].gc_id +'">'+ result[i].gc_name +'</option>'
                    } else {
                        html += '<option value="'+ result[i].gc_id +'">'+ result[i].gc_name +'</option>'
                    }
                }
                $('#search_gc_id2').html(html)
            },
            //请求失败，包含具体的错误信息
            error : function(e){
                console.log(e.status);
                console.log(e.responseText);
            }
        });
    }

    function getGcId2(gc_id1, select_id)
    {
        $.ajax({
            type : "GET",
            contentType: "application/json;charset=UTF-8",
            url : ADMINSITEURL+"/Question/getClass.html?gc_id=" + gc_id1,
            success : function(result) {
                result = JSON.parse( result );
                var html = '<option value="">选择分类</option>';
                for(var i=0;i<result.length;i++){
                    if (result[i].gc_id == select_id) {
                        html += '<option selected value="'+ result[i].gc_id +'">'+ result[i].gc_name +'</option>'
                    } else {
                        html += '<option value="'+ result[i].gc_id +'">'+ result[i].gc_name +'</option>'
                    }
                }
                $('#search_gc_id3').html(html)
            },
            //请求失败，包含具体的错误信息
            error : function(e){
                console.log(e.status);
                console.log(e.responseText);
            }
        });
    }
    //获取下级分类
    $('#search_gc_id1').on('change',function () {
        var gc_id1 = $(this).val();
        getGcId1(gc_id1)
    })

    $('#search_gc_id2').on('change',function () {
        var gc_id2 = $(this).val();
        getGcId2(gc_id2)
    })
</script>
{if $Request.param.search_gc_id1}
<script>

    // 编辑初始化，处理分类选中的问题
    var gc_id1 = '{$Request.param.search_gc_id1}';
    var gc_id2 = '{$Request.param.search_gc_id2}';
    var gc_id3 = '{$Request.param.search_gc_id3}';
    getGcId1(gc_id1, gc_id2)
    getGcId2(gc_id2, gc_id3)
</script>
{/if}
